unit FornecedorRecordFr;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, DBCtrls, ActnList, Buttons, ExtCtrls, MainRecordFr;

type

  { TFornecedorRecordFrame }

  TFornecedorRecordFrame = class(TMainRecordFrame)
    btBuscar: TBitBtn;
    desc_cidade: TDBEdit;
    id_fornecedor: TDBEdit;
    DBEdit10: TDBEdit;
    DBEdit11: TDBEdit;
    DBEdit14: TDBEdit;
    DBEdit15: TDBEdit;
    DBEdit16: TDBEdit;
    DBEdit17: TDBEdit;
    DBEdit18: TDBEdit;
    id_pessoa: TDBEdit;
    DBEdit23: TDBEdit;
    DBEdit24: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit4: TDBEdit;
    DBEdit5: TDBEdit;
    DBEdit6: TDBEdit;
    DBEdit8: TDBEdit;
    DBEdit9: TDBEdit;
    DBGroupBox1: TDBGroupBox;
    DBLookRamo: TDBLookupComboBox;
    DBMemo1: TDBMemo;
    ativo: TDBRadioGroup;
    FornecedorDBGroupBox: TDBGroupBox;
    Label1: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Ramo: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    procedure AlterarActionExecute(Sender: TObject);
    procedure btBuscarClick(Sender: TObject);
    procedure CancelarActionExecute(Sender: TObject);
    procedure id_pessoaChange(Sender: TObject);
    procedure SalvarActionExecute(Sender: TObject);

  private
    { private declarations }
  public
    { public declarations }
  end;

implementation

uses Initializator, MainFr, FornecedorDM, MainDM;

{ TFornecedorRecordFrame }


procedure TFornecedorRecordFrame.AlterarActionExecute(Sender: TObject);
begin
  FornecedorData.FornecedorZQuery.Edit();
 // DBLookRamo.Enabled := True;
  ControlaBotoes();
end;

procedure TFornecedorRecordFrame.btBuscarClick(Sender: TObject);
begin
  TheControl.ShowForeignFrame(TMainFrame(PessoaSearchFrame));
end;

procedure TFornecedorRecordFrame.CancelarActionExecute(Sender: TObject);
begin
  FornecedorData.FornecedorZQuery.Cancel();
  //DBLookRamo.Enabled := False;
  ControlaBotoes();
end;

procedure TFornecedorRecordFrame.id_pessoaChange(Sender: TObject);
begin
  if (FornecedorData.DataSetState() in [mdsEditing, mdsInserting]) then begin
    id_fornecedor.Text := id_pessoa.Text;
    ativo.ItemIndex := 0;
   // DBLookRamo.Enabled := True;
  end;
end;

procedure TFornecedorRecordFrame.SalvarActionExecute(Sender: TObject);
begin
  FornecedorData.FornecedorZQuery.Post();
 // DBLookRamo.Enabled := False;
  ControlaBotoes();
end;


initialization
  {$I fornecedorrecordfr.lrs}

end.

